<?php
	if ($this->paginator != null) {
		if (!isset($_GET['page']))
			$count	= 0;
		else
			$count	= ($_GET['page'] - 1)*$this->perpage;
?>
	<h2 style="font-weight: bold; padding-bottom: 10px;">Danh sách môn học</h2>
	<table class="table table-striped">
		<tr>
			<td style="width: 6%"><strong>STT</strong></td>
			<td style="width: 15%"><strong>Tên môn học</strong></td>
			<td style="width: 30%"><strong>Mô tả</strong></td>
			<td style="width: 12%"><strong>Thời gian thi (phút)</strong></td>
			<td style="width: 10%"><strong>Số câu hỏi</strong></td>
			<td style="width: 10%"><strong>Thêm</strong></td>
			<td style="width: 10%"><strong>Cập nhật</strong></td>
			<td style="width: 7%"></td>
		</tr>
	<?php foreach ($this->paginator as $item) : $count++;?>
		<tr>
			<td><?php echo $count?></td>
			<td><a href="<?php echo $this->basePath()?>/admin/questionbysubject/<?php echo $item->subject_id?>"><?php echo $item->subject_name;?></a></td>
			<td><?php echo $item->description;?></td>
			<td align="center"><?php echo $item->test_time;?></td>
			<td align="center"><?php echo $item->question_num;?></td>
			<td><?php echo $item->created_at;?></td>
			<td><?php echo $item->updated_at;?></td>
			<td align="center">
				<a href="<?php echo $this->basePath()?>/admin/editsubject/<?php echo $item->subject_id?>">
					<i class="glyphicon glyphicon-pencil"></i>
				</a>
				<a href="<?php echo $this->basePath()?>/admin/deletesubject/<?php echo $item->subject_id?>" Onclick="return ConfirmDelete()">
					<i class="glyphicon glyphicon-trash"></i>
				</a>
			</td>
		</tr>
		<?php endforeach; ?>
	</table>
<?php
	}

	$url	= "viewsubject";
	echo $this->paginationControl(
		$this->paginator,
		'sliding',
		array('partial/admin/paginator.phtml', 'Subject'),
		array(
			'route' => 'admin',
			'url'	=> $url,
		)
 	);